<template>
	<view>
		<view class="form">
			<view class="">
				<view class="form-title">
					提现金额
				</view>
				<view class="form-input xmt32 xflex-x-between">
					<view class="xflex-x-between form-ipt xflex1 boder">
						<input type="text" placeholder="请输入提现金额" v-model="money" />
						<view class="form-yuan">
							元
						</view>
					</view>
					<view class="form-all" @click="money = info.data.fund.money">
						全部
					</view>
				</view>

				<view class="form-money xmt20">
					可提现金额：<text>{{info.data.fund.money}} </text>
				</view>

				<view class="form-title xmt50">
					银行卡
				</view>
				<view class="form-input xmt32 xflex-x-between" >
					<view class="xflex-x-between form-ipt " @click="topage()">
						{{info.data.bank.hide_bank_no?info.data.bank.hide_bank_no:'请填写银行卡'}}

					</view>
					<view class="form-all" @click="openbrank()">
						查看
					</view>
				</view>


				<view class="sub" @click="getwithde()">
					提交
				</view>
			</view>
		</view>

		<view class="tips">
			<view class="xflex-x">
				<image class="tips-icon" src="/pagesA/static/images/tishi.png" mode=""></image>
				<view class="tips-title">
					提现说明
				</view>
			</view>
			
			
			<u-parse :content="info.contenrt"></u-parse>
			
			
		</view>

		<u-popup :show="nullshow" mode="center" :round="18">
			<view class="popup pr xflex-y-center xjc">
				<image class="pa popup-gb" @click="nullshow = false" src="/pagesA/static/images/guanbi1.png" mode="">
				</image>
				<view class="popup-title xmt40">
					银行卡号
				</view>

				<view class="popup-content xmt50" @click="copy(info.data.bank.bankno)">
					{{info.data.bank.bankno}}
				</view>
				<view class="popup-btn" @click="nullshow = false">
					复制卡号
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	import {
		partnercash,
		partnerinfo,
		indexcontent
	} from '../../../network/home.js'


	let money = ref('')

	const getwithde = () => {
		partnercash({
			money: money.value
		}).then(res => {
			console.log(res);
			
			uni.showToast({
				icon:"none",
				title:"提现成功"
			})
			getpartner()
		})
	}

	let nullshow = ref(false)

	const copy = (data) => {
		uni.setClipboardData({
			data: data + '',
			success: function() {
				console.log('复制成功');
				nullshow.value = false
				uni.showToast({
					icon: "none",
					title: "复制成功"
				})
			}
		})
	}

	let info = reactive({
		data: {
			address: "",
			bank: [],
			default: [],
			fund: {
				money: "0.00",
				today_order: 0,
				today_profit: 0,
				total_order: 0,
				total_profit: 0,
				total_trade: 0,
				yesterday_order: 0,
			},
			id: 2,
			image: "",
			name: "",
			
		},
		contenrt:''
	})
	
	indexcontent({name:'cash_intro'}).then(res=>{
		info.contenrt = res.data
	})
	
	
	
	const topage = (url) =>{
		uni.navigateTo({
			url:'/page/bankCard/bankCard'
		})
	}

	const openbrank = () => {
		nullshow.value = true
	}
	// 获取个人信息
	const getpartner = () => {
		partnerinfo().then(res => {
			info.data = res.data
		})
	}

	getpartner()
</script>
<style>
	page {
		background-color: #f5f5f5;
	}
</style>

<style lang="scss" scoped>
	.form {
		width: 690rpx;
		height: 678rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		margin: 22rpx auto;
		padding: 30rpx;
		box-sizing: border-box;

		&-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #333333;
		}

		&-input {
			width: 630rpx;
			height: 100rpx;
			background: #F5F5F5;
			border-radius: 16rpx;

		}

		&-ipt {
			padding: 0 33rpx;
		}

		&-all {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #999999;
			padding: 0 30rpx;
		}

		&-yuan {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #999999;

		}

		.boder {
			border-right: 1rpx solid #999999;
		}

		&-money {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #999999;

			&>text {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 28rpx;
				color: #333333;
			}
		}
	}

	.sub {
		width: 620rpx;
		height: 88rpx;
		background: linear-gradient(90deg, #0DBFFB, #198EFF);
		border-radius: 44rpx;

		font-family: PingFang SC;
		font-weight: 500;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 88rpx;
		margin-top: 65rpx;
	}

	.tips {
		padding: 40rpx 55rpx;
		box-sizing: border-box;

		&-icon {
			width: 26rpx;
			height: 26rpx;
		}

		&-title {
			font-family: PingFang SC;
			font-weight: 400;
			font-size: 24rpx;
			color: #333333;
		}
	}

	.popup {
		width: 600rpx;
		height: 370rpx;
		background: #FFFFFF;
		border-radius: 30rpx;

		&-gb {
			width: 40rpx;
			height: 40rpx;
			top: 30rpx;
			right: 30rpx;
		}

		&-title {
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
			text-align: center;
		}

		&-content {
			padding: 32rpx;
			width: 492rpx;
			height: 149rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #666666;
			line-height: 40rpx;
			text-align: center;
		}

		&-btn {
			width: 240rpx;
			height: 80rpx;
			background: linear-gradient(90deg, #0DBFFB, #198EFF);
			border-radius: 20rpx;
			line-height: 80rpx;
			text-align: center;
			color: #fff;
		}
	}
</style>